package cn.wolfcode.p2p.util;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 常量类
 */
public class Constants {

    /**
     * 昵称长度
     */
    public static final int LENGTH_MIN_NICKNAME = 2;
    public static final int LENGTH_MAX_NICKNAME = 6;
    //11位手机号
    public static final int LENGTH_PHONENUM = 11;

    //密码长度
    public static final int LENGTH_MIN_PASSWORD = 4;
    public static final int LENGTH_MAX_PASSWORD = 16;

    //验证码长度
    public static final int LENGTH_VERIFYCODE = 4;

    //发送验证码时间的间隔
    public static final int LENGTH_VERIFYCODE_TIME = 10;

    //初始值为0, 精确到四个小数点
    public static final BigDecimal ZERO = new BigDecimal("0.0000");
    //授信额度
    public static final BigDecimal BORROWLIMIT = new BigDecimal("50000.0000");
    //保存精度
    public static final int SCALE_SAVE = 4;
    //显示精度
    public static final int SCALE_SHOW = 2;
    //计算精度
    public static final int SCALE_CALCULATE = 8;

    //正则表达式,手机号的格式
    public static final String REGEX_PHONENUM = "^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";

    //最小借款金额
    public static final BigDecimal BORROW_MIN_AMOUNT = new BigDecimal("1000.0000");

    //最小投标金额
    public static final BigDecimal BID_MIN_AMOUNT = new BigDecimal("50.0000");

    //最小借款利率
    public static final BigDecimal MIN_CURRENTRATE = new BigDecimal("5.0000");

    //最小借款利率
    public static final BigDecimal MAX_CURRENTRATE = new BigDecimal("10.0000");


    // 按月分期还款(等额本息)
    public final static int RETURN_TYPE_MONTH_INTEREST_PRINCIPAL = 0;

    // 按月到期还款(每月还利息,到期还本息)
    public final static int RETURN_TYPE_MONTH_INTEREST = 1;
    // ---------------------标的类型--------------------------

    // 普通信用标(借款类型)
    public final static int BIDREQUEST_TYPE_NORMAL = 0;
    //债权标
    public final static int BIDREQUEST_TYPE_TRANSFER = 1;
    //体验标
    public final static int BIDREQUEST_TYPE_EXP = 2;

    //信用标借款期限
    public static final List<String> BORROW_RETURN_MONTHS = Arrays.asList("1", "3", "6", "9", "12");

    //体验标借款期限
    public static final int BORROW_EXP_RETURN_MONTHS = 1;


    //招标天数
    public static final List<String> BID_DISABLE_DAYS = Arrays.asList("1", "2", "3", "4", "5");

    // ---------------------借款状态---------------------------
    public final static int BIDREQUEST_STATE_APPLYING = 11;  // 借款申请
    public final static int BIDREQUEST_STATE_PUBLISH_PENDING = 0;   // 待发布
    public final static int BIDREQUEST_STATE_BIDDING = 1;           // 招标中
    public final static int BIDREQUEST_STATE_UNDO = 2;              // 已撤销
    public final static int BIDREQUEST_STATE_BIDDING_OVERDUE = 3;   // 流标
    public final static int BIDREQUEST_STATE_APPROVE_PENDING_1 = 4; // 满标1审
    public final static int BIDREQUEST_STATE_APPROVE_PENDING_2 = 5; // 满标2审
    public final static int BIDREQUEST_STATE_REJECTED = 6;          // 满标审核被拒绝
    public final static int BIDREQUEST_STATE_PAYING_BACK = 7;       // 还款中
    public final static int BIDREQUEST_STATE_COMPLETE_PAY_BACK = 8; // 已还清
    public final static int BIDREQUEST_STATE_PAY_BACK_OVERDUE = 9;  // 逾期
    public final static int BIDREQUEST_STATE_PUBLISH_REFUSE = 10;   // 发标审核拒绝状态

    /**
     * =============================账户流水类型================================
     */

    // 资金流水类别：线下充值
    // 可用余额增加
    public final static int ACCOUNT_ACTIONTYPE_RECHARGE_OFFLINE = 0;

    // 资金流水类别：提现成功
    // 冻结金额减少
    public final static int ACCOUNT_ACTIONTYPE_WITHDRAW = 1;

    // 资金流水类别：成功借款
    // 可用余额增加
    public final static int ACCOUNT_ACTIONTYPE_BIDREQUEST_SUCCESSFUL = 2;

    // 资金流水类别：成功投标
    // 冻结金额减少
    public final static int ACCOUNT_ACTIONTYPE_BID_SUCCESSFUL = 3;

    // 资金流水类别：还款
    // 可用余额减少
    public final static int ACCOUNT_ACTIONTYPE_RETURN_MONEY = 4;

    // 资金流水类别：回款
    // 可用余额增加
    public final static int ACCOUNT_ACTIONTYPE_CALLBACK_MONEY = 5;

    // 资金流水类别：支付平台管理费
    // 可用余额减少
    public final static int ACCOUNT_ACTIONTYPE_CHARGE = 6;

    // 资金流水类别：利息管理费
    // 可用余额减少
    public final static int ACCOUNT_ACTIONTYPE_INTEREST_SHARE = 7;

    // 资金流水类别：提现手续费
    // 冻结金额减少
    public final static int ACCOUNT_ACTIONTYPE_WITHDRAW_MANAGE_CHARGE = 8;

    // 资金流水类别：充值手续费
    // 可用余额减少
    public final static int ACCOUNT_ACTIONTYPE_RECHARGE_CHARGE = 9;

    // 资金流水类别：投标冻结金额
    // 冻结金额增加 可用余额减少
    public final static int ACCOUNT_ACTIONTYPE_BID_FREEZED = 10;

    // 资金流水类别：取消投标冻结金额
    // 标审核失败
    // 冻结金额减少
    // 可用余额增加
    public final static int ACCOUNT_ACTIONTYPE_BID_UNFREEZED = 11;

    // 资金流水类别：提现申请冻结金额
    // 冻结金额增加
    // 可用余额减少
    public final static int ACCOUNT_ACTIONTYPE_WITHDRAW_FREEZED = 12;

    // 资金流水类别:提现申请失败取消冻结金额
    // 冻结金额减少
    // 可用余额增加
    public final static int ACCOUNT_ACTIONTYPE_WITHDRAW_UNFREEZED = 13;

    //债权标转让成功,可用余额增加
    public final static int ACCOUNT_ACTIONTYPE_TRANSFER_SUCCESS = 14;

    //债权标认购成功,可用余额减少
    public final static int ACCOUNT_ACTIONTYPE_SUBSCRIPTION_SUCCESS = 15;

    //线上充值成功,可用余额增加
    public final static int ACCOUNT_ONLINE_RECHARGE_SUCCESS = 16;

    /**
     * ============系统账户流水类型=============
     */

    // 系统账户收到账户管理费（借款管理费）
    public final static int SYSTEM_ACCOUNT_ACTIONTYPE_MANAGE_CHARGE = 1;

    // 系统账户收到利息管理费
    public final static int SYSTEM_ACCOUNT_ACTIONTYPE_INTREST_MANAGE_CHARGE = 2;

    // 系统账户收到提现手续费
    public final static int SYSTEM_ACCOUNT_ACTIONTYPE_WITHDRAW_MANAGE_CHARGE = 3;

    /**
     * =========还款状态===============
     */

    // 正常待还
    public final static int PAYMENT_STATE_NORMAL = 0;

    // 已还
    public final static int PAYMENT_STATE_DONE = 1;

    // 逾期
    public final static int PAYMENT_STATE_OVERDUE = 2;


    //=========债权标状态===============

    //招标中
    public final static int TRANSFER_STATE_BIDDING = 0;

    //已撤销
    public final static int TRANSFER_STATE_REVOKE = 1;

    //已认购
    public final static int TRANSFER_STATE_SUBSCRIPTION = 2;


}
